package com.tgb.controller;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.tgb.model.UserDo;
import com.tgb.service.UserService;

@Controller
@RequestMapping("/new")
public class NewController {

	@Autowired
	private UserService userService;
	
	/**
	 * 获取所有用户列表
	 * @param request
	 * @return
	 */
	@RequestMapping("/new")
	public void  getAllUser(ModelMap request){
		
		request.put("kk", "kk1");
		  
	}
	@ResponseBody
	@RequestMapping(value="/newJson",produces = "text/html;charset=UTF-8")
	public String  getJson(ModelMap requestm,HttpServletResponse response){
		UserDo u=new UserDo();
		u.setAge("1");
		u.setUserName("顾巍");
		JSONObject json=new JSONObject();
		  String c = json.toJSONString(u);
		return c;
		  
	}
	
}
